// 引入共有组件
import hmNanBar from '@/components/hmNanBar.vue'
import moment from 'moment'
export default {
  install: function (Vue) {
    Vue.component(hmNanBar.name, hmNanBar)
    Vue.prototype.$baseUrl = process.env.VUE_APP_URL
    Vue.filter('formatTime', function (str) {
      const a = moment()
      const b = moment(str)
      const _diff = a.diff(b, 'h')

      if (_diff <= 1) {
        return '刚刚'
      } else if (_diff < 1560) {
        return _diff + '小时前'
      } else {
        return moment(str).format('YYYY/MM/DD HH:mm:ss')
      }
    })
  }
}
